<?php defined('SYSPATH') or die('No direct script access.');
/**
* Application System Helper
*/
class Helper_theSystems {
	
	static function &factory() {
	   $o = new Helper_theSystems();
	  return $o;	
	}
	
	// Set The System Configurations
	private function thesystem_value($system_setting)
	{
		$THE_SYSTEMS = array();

		// EDITABLE REGION <-- START -->
		// Permission Settings
		$THE_SYSTEMS['permission_to_enter_cms']        = 299;
		$THE_SYSTEMS['permission_to_enter_accounting'] = 799;
		$THE_SYSTEMS['permission_to_enter_website']    = 999;
		// Application Activations
		$THE_SYSTEMS['system_database_backup']         = 1;
		$THE_SYSTEMS['system_cms']                     = 1;
		$THE_SYSTEMS['system_website']                 = NULL;
		$THE_SYSTEMS['system_accounting_pointofsales'] = 1;
		$THE_SYSTEMS['system_accounting_backoffice']   = 1;
		// Application Settings
		$THE_SYSTEMS['system_base_language']           = 'EN';
		$THE_SYSTEMS['system_multilanguage']           = 1;
		$THE_SYSTEMS['system_multicurrency']           = NULL;
		$THE_SYSTEMS['system_captcha']                 = NULL;
		$THE_SYSTEMS['accounting_multistores']         = 1;
		// Module Activations
		$THE_SYSTEMS['module_users']                   = 1;
		$THE_SYSTEMS['module_products']                = 1;
		$THE_SYSTEMS['module_products_detail_type']    = NULL;//'skus';	// Value = NULL, 'tabs', 'skus', 'fifo'
		$THE_SYSTEMS['module_sitesettings']            = 1;
		$THE_SYSTEMS['module_contacts']                = 1;
		$THE_SYSTEMS['module_header']                  = 1;
		$THE_SYSTEMS['module_animations']              = 1;
		$THE_SYSTEMS['module_relatedsite']             = 1;
		$THE_SYSTEMS['module_websitepages']            = 1;
		$THE_SYSTEMS['module_shoppingcart']            = 1;
		$THE_SYSTEMS['module_galleries']               = 1;
		$THE_SYSTEMS['module_comments']                = 'all'; 	// Value = NULL, 'all'
		$THE_SYSTEMS['module_blogs']                   = 'feeds';	// Value = NULL, 'feeds'
		$THE_SYSTEMS['module_forums']                  = NULL;
		// Accounting
		$THE_SYSTEMS['accounting_multistores']         = 1;
		$THE_SYSTEMS['system_accounting_stock_cut']    = 1;
		$THE_SYSTEMS['setting_invoice_print_type']     = 02;
		// EDITABLE REGION <-- END -->

		return $THE_SYSTEMS[$system_setting];
	}

  // Get Value for Website Front End Default Template
	public function templating()
	{
		$web_page_template = DB::select('value')
			->from('configwebs')
			->where('key','=','website_templates')
			->limit(1)
			->execute();
		
		return $web_page_template[0]['value'];
	}
	
  // Get Value From theSystem Table
	public function system_auth($keys)
	{
		$system_auth_value = $this->thesystem_value($keys);

		if(!empty($system_auth_value))
		{
			return $system_auth_value;
		} else {
			return NULL;
		}
	}
	
  // Get Value From Config Table
	public function get_config($table, $keys)
	{
		$web_config_value = DB::select('value')
			->from('config'.$table)
			->where('key','=',$keys)
			->limit(1)
			->execute();
		
		if(!empty($web_config_value))
		{
			return $web_config_value[0]['value'];
		} else {
			return NULL;
		}
	}
	
	
	
	
	
	
	
	
	
	
}